Add unit tests for tidy parameter selection helpers#493
Add unit tests for tidy parameter selection helpers#493jgabry merged 3 commits intostan-dev:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #493 +/- ##
=======================================
Coverage 98.66% 98.66%
=======================================
Files 35 35
Lines 5857 5857
=======================================
Hits 5779 5779
Misses 78 78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Thanks! I would prefer to keep only a subset of these new tests that test previously untested behavior and drop the tests that only restate what test-helpers-mcmc.R already tests in
bayesplot/tests/testthat/test-helpers-mcmc.R
Lines 254 to 292 in a30a706
Worth keeping:
- direct param_range() no-match returns integer(0)
- direct param_range() partial-match silently drops missing indices
- direct param_glue() no-match returns integer(0)
- direct param_glue() partial-match silently drops missing names
- tidyselect_parameters() with negation
I think (although worth double checking) these are redundant with existing tests in test-helpers-mcmc.R and should be removed:
- the invalid-vars error tests
- the two prepare_mcmc_array(... vars(...)) integration tests
- param_range selects correct parameters by index
- param_glue selects correct parameters with one expression
- param_glue selects correct parameters with multiple expressions
- tidyselect_parameters selects by name
- tidyselect_parameters works with tidyselect helpers
- tidyselect_parameters works with contains()
|
thnx for the review, trimmed it down to just the 5 tests you mentioned: no-match, partial-match, and negation. Dropped everything already covered in test-helpers-mcmc.R |
Fixes #492
Summary
Added 5 unit tests for previously untested edge cases in
param_range(),param_glue(), andtidyselect_parameters():param_range()/param_glue()returninteger(0)when no parameters matchparam_range()/param_glue()silently drop non-matching indices/namestidyselect_parameters()works with negation (-alpha)